package com.yr.controller;

import com.yr.common.util.R;
import com.yr.entity.student;
import com.yr.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/student")
public class StudentController {
//    @Autowired
//    private StudentService studentservice;
//    @GetMapping("/list")
//    private R findAll(){
//        List<student> list = studentservice.list();
//        return R.ok().data("students",list);
//    }
    @Autowired
    private StudentService studentService;
    @GetMapping("/list")
    private R findAll(){
        List<student> list = studentService.list();
        return R.ok().data("students",list);
    }
}
